home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 7 / Amiga Format AFCD07 (Dec 1996, Issue 91).iso / serious / shareware / programming / aros / dos / attemptlockdoslist.c < prev    next >
C/C++ Source or Header  |  1996-09-12  |  2KB  |  72 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: attemptlockdoslist.c,v 1.3 1996/08/13 13:52:44 digulla Exp $
  4.     $Log: attemptlockdoslist.c,v $
  5.     Revision 1.3  1996/08/13 13:52:44  digulla
  6.     Replaced <dos/dosextens.h> by "dos_intern.h" or added "dos_intern.h"
  7.     Replaced __AROS_LA by __AROS_LHA
  8.  
  9.     Revision 1.2  1996/08/01 17:40:47  digulla
  10.     Added standard header for all files
  11.  
  12.     Desc:
  13.     Lang: english
  14. */
  15. #include <clib/exec_protos.h>
  16. #include "dos_intern.h"
  17.  
  18. /*****************************************************************************
  19.  
  20.     NAME */
  21.     #include <clib/dos_protos.h>
  22.  
  23.     __AROS_LH1(struct DosList *, AttemptLockDosList,
  24.  
  25. /*  SYNOPSIS */
  26.     __AROS_LHA(ULONG, flags, D1),
  27.  
  28. /*  LOCATION */
  29.     struct DosLibrary *, DOSBase, 111, Dos)
  30.  
  31. /*  FUNCTION
  32.     Tries to get a lock on some of the dos lists. If all went
  33.     well a handle is returned that can be used for FindDosEntry().
  34.     Don't try to busy wait until the lock can be granted - use
  35.     LockDosList() instead.
  36.  
  37.     INPUTS
  38.     flags - what lists to lock
  39.  
  40.     RESULT
  41.     Handle to the dos list or NULL. This is not a direct pointer
  42.     to the first list element but to a pseudo element instead.
  43.  
  44.     NOTES
  45.  
  46.     EXAMPLE
  47.  
  48.     BUGS
  49.  
  50.     SEE ALSO
  51.  
  52.     INTERNALS
  53.  
  54.     HISTORY
  55.     29-10-95    digulla automatically created from
  56.                 dos_lib.fd and clib/dos_protos.h
  57.  
  58. *****************************************************************************/
  59. {
  60.     __AROS_FUNC_INIT
  61.     __AROS_BASE_EXT_DECL(struct DosLibrary *,DOSBase)
  62.     if(flags&LDF_WRITE)
  63.     {
  64.     if(!AttemptSemaphore(&DOSBase->dl_DosListLock))
  65.         return NULL;
  66.     }else
  67.     if(!AttemptSemaphoreShared(&DOSBase->dl_DosListLock))
  68.         return NULL;
  69.     return (struct DosList *)&DOSBase->dl_DevInfo;
  70.     __AROS_FUNC_EXIT
  71. } /* AttemptLockDosList */
  72.